#pragma once
#include <cassert>
#include "Renderer.h"
#include "ShaderManagerOpenGL.h"
#include <vector>

#include "Resource.h"

#include "IL/il.h"
#pragma comment (lib, "DevIL.lib")

#define MAX_LOADSTRING 100

namespace banknamespace
{
	

	class OpenGLrenderer : public Renderer
	{
	public:
		//HWND m_hWnd;
		//HACCEL m_hAccelTable;
		HDC* m_hdcWindow;
		HGLRC m_renderingContext;

		OpenGLrenderer();
		~OpenGLrenderer(void);

		void init( HWND& m_hWnd, HDC& m_hdcWindow );

		// GL method
		void clear();
		void setProjection(float fov, float aspect, float znear, float zfar);
		void loadMatrix(float* matrix);
		void swapBuffer();

		unsigned int loadTexture( const char* szFilePath );
		unsigned int loadMemoryTexture( unsigned char* pixels, int width, int height );
		void bindTexture( unsigned int textureState, unsigned int textureId );
		void disableTexture( unsigned int textureState );

		int createProgram(const char* programName, std::vector<attrStruct>& attrString, std::vector<const char*>& uniformString);
		void useProgram(int progID);
		int getLocation(const char* name);
		void setVariable(int ulocation, shaderType type, void* value);

		unsigned int createBuffer( void* start, int bufferSize, bufferType type );
		void drawIndex(unsigned int idVBO, unsigned int idIBO, int strideSize, unsigned int startVertex, unsigned int endVertex, int indexCount, int startIndex, int baseVertex);
		
		// test
		void draw();
	protected:
		ShaderManagerOpenGL shaderManager;

		void InitializeOpenGL();
		void ShutdownOpenGL();
	};

}

